<?php slot('js_insideLoadFunction')?>
ADMIN_FILTER.key_search = '<?php echo __('filter_key_search',null,'table_list')?>';
ADMIN_FILTER.enabled = '<?php echo (intval($data['filter']['filter_enabled'])>=0 && intval($data['filter']['filter_enabled'])<=1)?$data['filter']['filter_enabled']:'-1'?>';
ADMIN_FILTER.action = {
	error:{
		rowSelectedEmpty: '<?php echo __('error_row_selected', null, 'table_list')?>'
	},
	confirm:{
		deleteConfirm: '<?php echo __('row_delete_confirm', null, 'table_list')?>'
	}
}
ADMIN_FILTER.initFilter();
$('#filter_cate_id').val('<?php echo $data['filter']['filter_cate_id']?>').attr('selected', true);

$('a.ajax-get-show').click(function(){
				var $ob = $(this);
				if($ob.attr('data-require') == 'selected' && $('input[type=checkbox].select_list:checked').length <=0){
					alert($ob.attr('data-error'));
					return false;
				};
				$.ajax({
					type: "POST",
					url: $ob.attr('data-url'),
					data: {
						
					},
					cache: false,
					success: function(data){
						var $select = $('input[type=checkbox].select_list:checked');
						if(data){
							var $js = $.parseJSON(data);
							var $str = '<div id="change-cate" style="min-width: 400px; padding: 10px;line-height: 1.8em; height: 100px; border: 1px solid #ccc;"><span>'+$js.title+'</span><br/><select style="min-width: 200px;" name="cate-change" id="cate-change">';
							for($i = 0; $i < $js.data.length; $i++){
									$str += '<option value="'+$js.data[$i].id+'">'+$js.data[$i].name+'</option>';
								
							}
							$str += '</select><br/><input type="button" style="margin-top: 20px;padding: 5px 10px;height: 24px;background: url(/css/admin/img/global/button-bg.png) left center repeat-x;color: #fff;border: none;border-radius: 5px;padding: 4px 25px;cursor: pointer;width: auto;" value="'+$js.btn+'" class="button" name="change-cate" id="btn-change"/></div>';
							
							$.fancybox.close();
							$.fancybox.open($str,{
								padding : 20,
								title: $js.title,
								helpers: {
									overlay:{
										closeClick : false
									} 
								}
							});
							$('input#btn-change').unbind('click').click(function(){
								if($('select#cate-change').val() == '-1'){
									alert($js.error);
									return;
								}
								$ids = Array();
								$c = 0;
								$select.each(function(){
									$ids[$c++] = $(this).val();
								});
								$.ajax({
									type: "POST",
									url: $ob.attr('data-url'),
									data: {
										ids: $ids,
										confirm: 1,
										cate_id: $('select#cate-change').val()
									},
									cache: false,
									success: function(data){
										$('div#change-cate').html(data);
									}
								});
							});
						}
					}
				});
			});
<?php end_slot()?>

<?php slot('header_css')?>
<style type="text/css">
<!-- 
/*div.box-content-main table.table-list td.cate_id{
	width: 200px;
}
div.box-content-main table.table-list td.title{
	width: 200px;
}
div.box-content-main table.table-list td.description{
	width: 200px;
}
div.box-content-main table.table-list td.tags{
	width: 100px;
}*/
-->
</style>
<?php end_slot()?>
<div class="box-navigation">
	<?php echo $data['navigation']?>
</div>
<div class="clr"></div>
<div class="box-filter">
	<form action="?" method="get" name="filter_form" id="filter_form">
		<select name="filter[filter_cate_id]" id="filter_cate_id" class="combo-box">
			<option value="-1"><?php echo __('option_cate_all', null, 'major_majors')?></option>
			<?php foreach($data['filter_form_cate'] as $val):?>
			<option value="<?php echo $val['id']?>"><?php echo $val['name']?></option>
			<?php endforeach;?>
		</select>
		<input type="text" maxlength="255" name="filter[filter_key]" id="filter_key" value="<?php echo empty($data['filter']['filter_key'])?__('filter_key_search',null,'table_list'):$data['filter']['filter_key']?>"/>
		<input type="submit" name="filter[filter_submit]" id="filter_submit" class="button" value="<?php echo __('filter_submit',null,'table_list')?>"/>
	</form>
</div>
<div class="clr"></div>
<div class="box-content">
	<form action="<?php echo $data['filter_action']?>" method="post" name="form_main" id="form_main">
		<input type="hidden" value="-1" name="action_token" id="action_token"/>
		<input type="hidden" value="none" name="action_name" id="action_name"/>
		<div class="control">
			<a href="#" class="a-control-get add" data-action="<?php echo ADMIN_DEFINED::ADD_RECORD?>" data-require="none"><?php echo __('control_add',null,'table_list')?></a>
			<a href="#" class="a-control delete" data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>" data-require="selected" data-confirm="confirm"><?php echo __('control_delete',null,'table_list')?></a>
			<a href="#" class="ajax-get-show change-cate" data-require="selected" data-error="<?php echo __('error-select', null, 'table_list')?>" data-url="?action_name=<?php echo ADMIN_DEFINED::CHANGE_CATE?>"><?php echo __('control_change_cate',null,'table_list')?></a>
		</div>
		<div class="clr"></div>
		<div class="box-content-main">
			<table class="table-list" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td class="head checkbox-select"><input type="checkbox" name="select_checkall" id="select_checkall" title="<?php echo __('to_checkall',null,'table_list')?>" class="chk-select"/></td>
					<td class="head name"><?php echo __('head_name',null,'major_majors')?></td>
				</tr>
				<?php 
				$count_for = 0;
				foreach($data['list'] as $val):?>
				<tr class="class<?php echo ++$count_for%2?> enable-<?php echo intval($val['is_enabled'])?>">
					<td class="checkbox-select"><input type="checkbox" name="select_list[]" class="select_list" value="<?php echo $val['id']?>" id="select_<?php echo $val['id']?>" title="<?php echo __('to_check',null,'table_list')?>" /></td>
					<td class="name">
						<a href="#" class="a-control-get edit" data-action="<?php echo ADMIN_DEFINED::EDIT_RECORD?>&id=<?php echo $val['id']?>" data-require="none">
							<?php echo $val['name']?>
						</a>
					</td>
				</tr>
				<?php endforeach;?>
				<?php if($count_for ==0):?>
				<tr>
					<td colspan="3">
						<div  class="note"><?php echo __('no_row_founded',null,'table_list')?></div>
					</td>
				</tr>
				<?php endif;?>
			</table>
		</div>
		<div class="clr"></div>
		<div class="control">
			<a href="#" class="a-control-get add" data-action="<?php echo ADMIN_DEFINED::ADD_RECORD?>" data-require="none"><?php echo __('control_add',null,'table_list')?></a>
			<a href="#" class="a-control delete" data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>" data-require="selected"><?php echo __('control_delete',null,'table_list')?></a>
			<a href="#" class="a-control save-order" data-action="<?php echo ADMIN_DEFINED::SAVE_ORDER?>" data-require="none"><?php echo __('control_save_order',null,'table_list')?></a>
		</div>
		<?php if(count($data['pagination_pager'])>1):?>
		<div class="pagination">
			<span><?php echo __('pagination_text',null,'table_list')?></span>
			<span class="pagination"> 
			<?php foreach ($data['pagination_pager'] as $p):?>
				<a href="<?php echo empty($p['url'])?'#':($data['app_prefix'].$p['url'])?>" class="<?php echo $p['page_class']?>"><?php echo $p['page_num']?></a>
			<?php endforeach;?>
			</span>
			<div class="clr"></div>
		</div>
		<?php endif;?>
		<div class="clr"></div>
	</form>
</div>